# 描述分析
import pandas as pd


class DescribeO:
    def __init__(self, name=None, min_value=None, max_value=None, avg_value=None, std_value=None, skew_value=None,
                 kurt_value=None):
        self.name = name
        self.min_value = min_value
        self.max_value = max_value
        self.avg_value = avg_value
        self.std_value = std_value
        self.skew_value = skew_value
        self.kurt_value = kurt_value


def describe(cur_df):
    res = cur_df.describe()
    objs = []
    for k, row in res.items():
        objs.append(DescribeO(name=k, min_value=row['min'], max_value=row['max'], avg_value=row['mean'],
                              std_value=row['std']))
    obj_dicts = dict()
    for i in objs:
        obj_dicts[i.name] = i
    skews = cur_df.skew().to_dict()  # 偏度
    for sk, sv in skews.items():
        cur_value = obj_dicts.get(sk)
        if cur_value:
            cur_value.skew_value = sv
        obj_dicts[sk] = cur_value
    kurts = cur_df.kurt().to_dict()  # 峰度
    for kk, kv in kurts.items():
        cur_value = obj_dicts.get(kk)
        if cur_value:
            cur_value.kurt_value = kv
        obj_dicts[kk] = cur_value
    return obj_dicts


if __name__ == '__main__':
    pass
